package br.com.datatraffic.restricao.domain.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data @EqualsAndHashCode(exclude = { "municipio", "irregularidades", "placa", "classificacao" }, callSuper = false) @ToString(exclude = { "municipio", "irregularidades", "placa", "classificacao" }) @Entity public class Veiculo {
	@Id @SequenceGenerator(name = "VEICULO_SEQ", sequenceName = "VEICULO_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "VEICULO_SEQ") @Column(name = "VEICULO_ID", nullable = false) private Long id;
	private Integer anoFabricacao;
	private Integer anoModelo;
	private String chassi;
	private Date dataConsulta;
	private String renavam;
	private Float tara;
	@OneToOne @JoinColumn(name = "municipio_id") private Municipio municipio;
	@ManyToMany @JoinTable(name = "TBIRREGULARIDADE_VEICULO", joinColumns = { @JoinColumn(name = "VEICULO_ID") }, inverseJoinColumns = { @JoinColumn(name = "IRREGULARIDADE_ID") }) private List<Irregularidade> irregularidades = new ArrayList<Irregularidade>();
	private String placa;
	@ManyToOne @JoinColumn(name = "classificacao_id") private Classificacao classificacao;
}
